cmake_minimum_required(VERSION 2.4.3)
project(omnibus-filetransfer)

### LIBS
## BOOST
find_package(Boost REQUIRED COMPONENTS system filesystem date_time)

## Ariba
# BRANCH: Ariba-Prefix manually set
IF ( ARIBA_PREFIX )
    # include
    FIND_PATH(ARIBA_INCLUDE_DIR ariba/ariba.h
      PATH_SUFFIXES include
      PATHS
      ${ARIBA_PREFIX}
      NO_DEFAULT_PATH
    )
  
    # lib
    FIND_LIBRARY(ARIBA_LIBRARY
      NAMES ariba ariba_dht
      PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
      PATHS
      ${ARIBA_PREFIX}
      NO_DEFAULT_PATH
    )
    
    
    FIND_LIBRARY(ARIBA_DHT_LIBRARY
      NAMES ariba_dht
      PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
      PATHS
      ${ARIBA_PREFIX}
      NO_DEFAULT_PATH
    )
    
    # found
    IF ( ARIBA_INCLUDE_DIR AND ARIBA_LIBRARY )
        SET ( ARIBA_FOUND TRUE )
    ENDIF ()
    
# BRANCH: find Ariba
ELSE ( ARIBA_PREFIX )
    SET( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules )
    find_package(Ariba REQUIRED)
ENDIF ( ARIBA_PREFIX )

## include
include_directories(${Boost_INCLUDE_DIR} ${ARIBA_INCLUDE_DIR})

message(STATUS "found ariba: ${ARIBA_FOUND}" )
message(STATUS "ariba include: ${ARIBA_INCLUDE_DIR}" )
message(STATUS "ariba lib: ${ARIBA_LIBRARY}" )
message(STATUS "ariba DHT: ${ARIBA_DHT_LIBRARY}")



### BIN
add_executable(omnibus-bin
 ## TOP LEVEL
 Access_attributes.cpp Access_attributes.h Blocking_buffer.cpp Blocking_buffer.h Chat.h Chat.cpp FileInfo.cpp FileInfo.h Filetransfer.cpp Filetransfer.h Flow_control.cpp Flow_control.h main.cpp Network.cpp Network.h Payload.cpp Payload.h Phrase_connector.cpp Phrase_connector.h simple_socket.cpp simple_socket.h Transport.cpp Transport.h UI_multiplexer.cpp UI_multiplexer.h User.cpp Userdatabase.cpp Userdatabase.h User.h Config.h Config.cpp ARQQueue.h ARQQueue.cpp

 ## EXCEPTIONS
 exceptions/not_found_exception.cpp exceptions/not_found_exception.h

 ## INTERFACES
 interfaces/DataReceiverInterface.h interfaces/DhtInterface.h interfaces/ConnStatInterface.h interfaces/LinkEstablishedInterface.h interfaces/MessageHandlerInterface.h interfaces/Userinputinterface.h interfaces/Useroutputinterface.h
 
 ## LIBS
 libs/reboost_buffers/buffer.hpp libs/reboost_buffers/buffer.cpp libs/reboost_buffers/buffers.hpp libs/reboost_buffers/message.hpp libs/reboost_buffers/message.cpp libs/reboost_buffers/shared_buffer.hpp libs/reboost_buffers/shared_buffer.cpp libs/substreambuf/prefix_streambuf.hpp
 
 ## MESSAGES
 messages/ChatMessage.cpp messages/ChatMessage.h messages/ExtendedChatMessage.cpp messages/ExtendedChatMessage.h messages/ChatAck.cpp messages/ChatAck.h messages/Filetransfer messages/MeetMessage.cpp messages/MeetMessage.h messages/TransportMessage.cpp messages/TransportMessage.h messages/ConnectMessage.h messages/ConnectMessage.cpp messages/ConnectConfirmMessage.h messages/ConnectConfirmMessage.cpp

 
 ## MESSAGES (FILETRANSFER)
 messages/Filetransfer/PauseMessage.h messages/Filetransfer/PauseMessage.cpp messages/Filetransfer/AcceptMessage.cpp messages/Filetransfer/AcceptMessage.h messages/Filetransfer/CustodyRequestMessage.cpp messages/Filetransfer/CustodyRequestMessage.h messages/Filetransfer/DeclineMessage.cpp messages/Filetransfer/DeclineMessage.h messages/Filetransfer/PayloadMessage.cpp messages/Filetransfer/PayloadMessage.h messages/Filetransfer/PullAcceptMessage.cpp messages/Filetransfer/PullAcceptMessage.h messages/Filetransfer/PullRequestMessage.cpp messages/Filetransfer/PullRequestMessage.h messages/Filetransfer/PushRequestMessage.cpp messages/Filetransfer/PushRequestMessage.h messages/Filetransfer/BundleInfoMessage.cpp messages/Filetransfer/BundleInfoMessage.h
 
 ## SYSTEM EVENTS (kommen wohl wieder weg..)
 SystemEvents/Filetransfer/ResumeTransferEvent.h SystemEvents/Filetransfer/ResumeTransferEvent.cpp
 
 ## SYNC
 sync/Dir_syncer.h sync/Dir_syncer.cpp sync/Sync.h sync/Sync.cpp sync/Sync_File.h sync/Sync_File.cpp sync/Sync_Directory.h sync/Sync_Directory.cpp sync/Sync_Regular_File.h sync/Sync_Regular_File.cpp

 sync/messages/SyncInitMessage.h sync/messages/SyncInitMessage.cpp sync/messages/OfferMessage.h sync/messages/OfferMessage.cpp sync/messages/SyncControlMessage.cpp sync/messages/SyncControlMessage.h
 
 sync/interfaces/ScanCompletedInterface.h sync/interfaces/SyncUpdatedInterface.h
)



### LINKER
target_link_libraries(omnibus-bin ${Boost_LIBRARIES} ${ARIBA_LIBRARY} ${ARIBA_DHT_LIBRARY})


### INSTALL
INSTALL(TARGETS omnibus-bin
	RUNTIME DESTINATION bin
)

#set(CMAKE_BUILD_TYPE Release)
set(CMAKE_BUILD_TYPE Debug)

